/*test function with pointers  
 */
 
#include <stdlib.h> 

struct tree {
	int data;
	struct tree * left;
	struct tree * right;
};
/*@*/
struct tree *  buildTree( struct tree * root,int depth)
{
  int i;
	struct tree * p;
	struct tree * q;
	
	
	i=0;
	if (depth==0)
	{
	  return root;
	}
	else {
		q= (struct tree * ) malloc (sizeof (struct tree));
		q->left=NULL;
		q->right=NULL;
		p=(struct tree *)malloc(sizeof (struct tree));
		p->left=NULL;
		p->right=NULL;
		q->data=depth;
		p->data=depth;
		root->left=buildTree(p,depth-1);
		root->right=buildTree(p,depth-1);
		return root;
	}	
}
/*@*/
/*@*/
void printTree(struct tree * root)
{
	if(root!=NULL)
	{
		print(root->data);
		printTree(root->left);
		printTree(root->right);
		return;
	}
	else
	{
	  return;
	}
}
/*@*/
/*@*/
int main()
{
	struct tree *root ;
	root = (struct tree *)malloc(sizeof (struct tree)) ;
	root->data=5;
	root= buildTree(root,3);
	printTree(root);
	return 0;
}
/*@*/
